<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class MoneyFlow extends Model
{
    //是否有效
    const INVALID = 0;
    const VALID = 1;

    const TYPE_USER_PAY_ORDER = 1;//支付订单消费
    const TYPE_FROM_PUBLISH = 2;//发布信息收入
    const TYPE_WITHDRAW = 3;//提现
    const TYPE_INVITE_PUBLISHER = 4;//邀请发布者
    const TYPE_INVITE_USER = 5;//邀请用户购买
    const TYPE_PLATFORM_PUBLISH_COMMISSION = 101;//平台通过发布者的信息订单获取佣金
    const TYPE_PLATFORM_INVITE_USER_COMMISSION = 102;//平台给邀请用户的人发放佣金
    const TYPE_PLATFORM_INVITE_PUBLISHER_COMMISSION = 103;//平台给邀请发布者的人发放佣金

    public function scopeValid($query)
    {
        $query->where('is_valid', self::VALID);
    }
}
